﻿#ifndef PST_DATACLIPPERFILTER_H
#define PST_DATACLIPPERFILTER_H

#include <QObject>
#include <vtkSmartPointer.h>
#include "IVtkFilter.h"

class vtkPlane;
class vtkActor;
class vtkDataSet;
class vtkLookupTable;
class vtkClipPolyData;
class vtkPolyDataMapper;
class vtkDataSetSurfaceFilter;

namespace pst
{
    class DataClipperFilter : public IVtkFilter
    {
    public:
        DataClipperFilter();
        ~DataClipperFilter();

    public:
        virtual void setInput(vtkDataObject* inputDatas) override;
        virtual vtkDataObject* getOutput();

        //法向方向 0:X  1:Y  2:Z
        void setPlaneNormalDirection(double x, double y, double z);
        double* getPlaneNormalDirection();

        void setPlaneOrigin(double posx, double posy, double posz);
        double* getPlaneOrigin();

        void setInsideOut(bool insideout);
        bool getInsideOut();
        //void setLookupTable(vtkLookupTable* lut);
        //vtkLookupTable* getLookupTable();

        virtual void update() override;

        //vtkSmartPointer<vtkActor> getClipActor();

    private:
        void initPipeLine();

        double m_planeNormalDirection[3];
        double m_planeOrigin[3];

        vtkDataObject* m_dataSetList;
        vtkSmartPointer<vtkDataSetSurfaceFilter> m_surfaceFilter;
        vtkSmartPointer<vtkPlane> m_clipPlane;
        vtkSmartPointer<vtkClipPolyData> m_clipFilter;
        //vtkSmartPointer<vtkPolyDataMapper> m_mapper;
        //vtkSmartPointer<vtkActor> m_actor;
        //vtkLookupTable* m_lookupTable;
        bool enabled;
    };

}
#endif
